package com.algo.animal;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class Dog implements InitializingBean, DisposableBean, FoodStuffAware {

    private FoodStuff foodStuff;

    public Dog() {
//        System.out.println("dog 无参构造。。。");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
//        System.out.println("dog afterPropertiesSet method invoke ....");
    }

    @Override
    public void destroy() throws Exception {
//        System.out.println("dog destroy method invoke ....");
    }

    @Override
    public void setFoodStuff(FoodStuff foodStuff) {
        this.foodStuff = foodStuff;
    }

    public void eat() {
        System.out.println("dog eat " + foodStuff.getName());
    }
}
